<template>
    <div>
      <form>
        <label>姓名：</label>
        <input type="text" v-model="name"><br><br>
  
          <label>年龄：</label>
          <input type="number" v-model="age"><br><br>
  
            <label>身高：</label>
            <input type="number" v-model="high">(米)<br><br>
  
              <label>体重：</label>
              <input type="number" v-model="weight">(公斤)<br><br>
  
                <label>病史：</label>
                <input type="text" v-model="history"><br><br>
  
                  <button @click.prevent="getBMI">诊断</button>
                </form>
  
      <p>患者  的诊断结果: {{result}}</p>
    </div>
  </template>
  
  <script>
    export default {
      data () {
        return {
          name:'小陈',
          age:'22',
          high:'1.67',
          weight:'54',
          history:'无',
          result:''
        }
      },
      methods: {
        getBMI(){
          const bmi =(this.weight/this.high)^2
          if(bmi >= 18.5 && bmi <= 23.9){
            this.result = '健康'
          }else if(bmi <= 18.5){
            this.result = '你太瘦了，建议多吃饭，保持身体健康~~'
          }else{
            this.result = '有点超重哦，建议运动起来~~'
          }
  
  
          }
        
      }
    }
  </script>
  